package tech.aistar.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import tech.aistar.mapper.AttractionMapper;
import tech.aistar.pojo.Attraction;

import java.util.List;

@Async
@Service
public class AttractionServiceImpl implements AttractionService {
    @Autowired
    private AttractionMapper attractionMapper;

    @Override
    public PageInfo<Attraction> pageInfo(String location, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<Attraction> list = attractionMapper.getListByLocation(location);
        PageInfo<Attraction> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }

    @Override
    public List<Attraction> getAll() {
        List<Attraction> list = attractionMapper.getAll();
        return list;
    }


}
